The package com.samsung.zirconia provides the functions of Zirconia for Android a simple copy protection library for Samsung Mobile devices based on Android platform.

Zirconia protects applications from illegal use by checking license. The license is retrieved from the license server and stored on the local storage of the device when the application is executed for the first time (or whenever the license does not exists or is not valid). Every license retrieved from the license server is unique for each device and application. So if an application is copied from a device to another, it does not work on there.

The internal flow of Zirconia checks license is shown below:

  1. Zirconia checks the license on the local storage of the device.
  2. If the local license exists and is valid, unlocks the application.
  3. If the local license does not exist or is not valid, connects and sends the information of device and application to the license server.
    (No more internet connectivity is needed after the license is stored on the local storage of the device.)
  4. If the application was bought for the device, the license server sends valid license to Zirconia.
  5. Zirconia stores the license on the local storage of the device.
  6. Starts over from 1.

Zirconia will control the flow above. You do not need to care about it.

 

Prerequisites

Zirconia for android consists of the java archive Zirconia.jar and the native shared library libnativeinterface.so.
You must add Zirconia.jar to your Android application project,
Like this:


and locate libnativeinterface.so under the path [Project Path]/libs/armeabi.
Like this:

Zirconia uses the Internet connectivity and device information to retrieve license from the license server and to check a validity of license.
You must add uses-permissions INTERNET and READ_PHONE_STATE to AndroidManifest.xml of your application.
Like this:

 

Coding Tips

Do not call Zirconia.checkLicense() crazily. Zirconia is not a heavy library, but it contains file I/O and en/decryption process when it checks validity of the license stored on the device. You must not use Zirconia.checkLicense() method where rapidity is needed or inside of a infinite loop. For example, if you use that method in the event handler, the overall speed will be degraded dramatically because every event will invoke file I/O and en/decryption.

Make your listener methods short. As you know, Zirconia does not have any method which returns boolean result of validation, but has asynchronous method Zirconia.checkLicense() which calls the listener methods in the listener instance when the validation ends. It creates a thread to check license, and the thread will not be finished until the listener method is finished. So you must implement your listener methods as short as possible. (to finish internal thread as soon as possible.)

Zirconia does not work when the phone is in offline mode, so you must encourage users to turn the phone on before initialize Zirconia instance. If the phone is in offline mode, Zirconia may returns EZIRCONIA_INVALID_VALUE error.

Further tips will be updated.

 

@version 1.120 @author Jaewon Choi (jae1.choi@samsung.com), © 2011 Samsung Electronics